﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data;
using System.Data.OleDb;

namespace DAL
{
    public class NhapDiem_DAL
    {
        static OleDbConnection KN;
        public static DataTable LoadDSSV()
        {
            string sChuoiTruyVan = string.Format("select SINHVIEN.MASV,SINHVIEN.HOTEN,SINHVIEN.NGAYSINH,DIEM.DIEMHS1,DIEM.DIEMHS2,DIEM.DIEMTHI,DIEM.DIEMCUOIKY,DIEM.GHICHU from DIEM,SINHVIEN where SINHVIEN.MASV=DIEM.MASV" );
            //Mo ket noi;
            KN = DataProvider.KetNoi();
            //Lay du lieu tu csdl do vao datatable
            DataTable dtDSSV = DataProvider.LayDuLieuDataTable(sChuoiTruyVan, KN);
            //Ngat Ket noi
            DataProvider.DongKetNoi(KN);
            return dtDSSV;
        }

        public static DataTable LoadCMBLop()
        {
         
            //Lenh truy van
            string sChuoiTruyVan = " Select * from Lop";
            //Chuoi ket noi
            KN = DataProvider.KetNoi();
            DataTable dtCmbLopHoc = DataProvider.LayDuLieuDataTable(sChuoiTruyVan, KN);
            //Ngat ket noi
            DataProvider.DongKetNoi(KN);
            return dtCmbLopHoc;
        
        }

        public static DataTable LoadCMBMON()
        {
            //Lenh truy van
            string sChuoiTruyVan = " Select * from MONHOC";
            //Chuoi ket noi
            KN = DataProvider.KetNoi();
            DataTable dtCmbMonHoc = DataProvider.LayDuLieuDataTable(sChuoiTruyVan, KN);
            //Ngat ket noi
            DataProvider.DongKetNoi(KN);
            return dtCmbMonHoc;
        }
    }
}
